<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<script type="text/javascript" src="js/jquery-3.5.1.min.js"></script>
<script type="text/javascript">
    function pay(){
        $.ajax({
            type: "POST",
            url: "pay",
            data: {},
            success: function (data) {
                if (data==="success") {
                    location.href="success.html";
                }else {
                    location.href="failHistory.html";
                }
            }
        });
    }
</script>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>等待付款</title>
</head>
<body>
<button id="pay" onclick="setTimeout('pay()', Math.random()*6000)">付款</button>
</body>
</html>